<template>
  <el-dialog
    title="设备信息"
    :visible.sync="dialogVisible"
    width="30%"
    :before-close="handleClose"
  >
    <div v-for="(value, key) in deviceInfo" :key="key">
      {{ key }}: {{ value }}
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">关闭</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  props: {
    deviceInfo: {
      type: Object,
      required: true
    },
    visible: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      dialogVisible: this.visible
    };
  },
  methods: {
    handleClose(done) {
      this.dialogVisible = false;
      done();
    }
  }
};
</script>

<style scoped>
/* 可以在这里添加样式 */
</style>  